<?php
/**
 * Created by PhpStorm.
 * User: zengyuming
 * Date: 2017/9/19
 * Time: 下午11:14
 */

namespace Admin\Model;
use Think\Model;

class merchantModel extends Model {
     // 获取商户信息
    // select a.merchant_id , a.merchant_key , b.Userremarks , b.money , (select  max(update_begtime)  from zym_transaction where pay_status = 1 and merchant = a.merchant_id limit 1) as last_time from zym_merchant as a left join zym_user as b on a.merchant_id = b.merchant_id // 原Sql
    public function getMerchantInfo(){
        $Model = $this;
        $result = $Model->alias("a")
              ->field("a.merchant_id , a.merchant_key , b.Userremarks , b.money , (select  max(update_begtime)  from zym_transaction where pay_status = 1 and merchant = a.merchant_id limit 1) as last_time")
              ->join("left join zym_user as b on a.merchant_id = b.merchant_id")
              ->select();
        return $result;
    }
}

